{extend name="public/base" /}

{block name="title"}<title>{if $data}{:lang('edit')}{else /}{:lang('create')}{/if}</title>{/block}

{block name="pjax_container"}
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <div class="nav-tabs-custom">
                <ul class="nav nav-tabs">
                    <li class="active"><a href="#tab1" data-toggle="tab">{:lang('base_param')}</a></li>
                    <li><a href="#tab2" data-toggle="tab">{:lang('base_avatar')}</a></li>
                    <li class="pull-right"><a href="javascript:history.back(-1)" class="btn btn-sm"><i class="fa fa-list"></i> {:lang('back')}</a></li>
                </ul>
                <div class="tab-content">
                    <div class="tab-pane active" id="tab1">
                        <form class="form-horizontal" method="POST" action="" onsubmit="return false" >
                            {:widget('common/Hidden/index', [$data, [
                                'name' => 'id',
                            ]])}
                            {:widget('common/Text/index', [$data, [
                                'name' => 'username',
                                'title' => lang('username'),
                            ]])}
                            {:widget('common/Input/index', [$data, [
                                'name' => 'password',
                                'title' => lang('password'),
                                'placeholder' => lang('password'),
                                'validate' => lang('password_require'),
                                'inputtype' => 'password',
                            ]])}
                            {:widget('common/Input/index', [$data, [
                                'name' => 'repassword',
                                'title' => lang('repassword'),
                                'placeholder' => lang('repassword'),
                                'inputtype' => 'password',
                            ]])}
                            {:widget('common/Input/index', [$data, [
                                'name' => 'name',
                                'title' => lang('name'),
                                'placeholder' => lang('name') ,
                                'validate' => lang('name_require'),
                            ]])}
                            {:widget('common/Input/index', [$data, [
                                'name' => 'mobile',
                                'title' => lang('mobile'),
                                'placeholder' => lang('mobile'),
                            ]])}
                            {:widget('common/Input/index', [$data, [
                                'name' => 'email',
                                'title' => lang('email'),
                                'placeholder' => lang('email'),
                            ]])}
                            {:widget('common/Select/index', [$data, [
                                'name' => 'sex',
                                'title' => lang('sex'),
                                'from' => 'selectlist',
                                'fromcfg' => 'sex',
                            ]])}
                            {:widget('common/Input/index', [$data, [
                                'name' => 'qq',
                                'title' => lang('qq'),
                                'placeholder' => $Think.lang.qq,
                            ]])}
                            {:widget('common/Select/index', [$data, [
                                'name' => 'status',
                                'title' => lang('status'),
                                'from' => 'selectlist',
                                'fromcfg' => 'status',
                            ]])}
                            <div class="form-group">
                                <div class="col-sm-2"></div>
                                <div class="col-sm-6">
                                    <div class="btn-group">
                                        <button type="submit" class="btn btn-info pull-right submits" data-loading-text="&lt;i class='fa fa-spinner fa-spin '&gt;&lt;/i&gt; {:lang('submit')}">{:lang('submit')}</button>
                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="tab-pane" id="tab2">
                        <div class="form-horizontal">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">{$Think.lang.avatar}</label>
                                <div class="col-sm-7">
                                    <div id="avatar-box">
                                        <div class="ibox-content">
                                            <div class="row">
                                                <div id="crop-avatar" class="col-md-6">
                                                    <div class="avatar-view" title="点击修改头像">
                                                        <img src="{$data.avatar}" alt="avatar">
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="modal fade" id="avatar-modal" aria-hidden="true" aria-labelledby="avatar-modal-label" role="dialog" tabindex="-1">
                                            <div class="modal-dialog modal-lg">
                                                <div class="modal-content">
                                                    <form class="avatar-form" action="{:url('Uploads/cropper')}?dir=avatar" enctype="multipart/form-data" method="post">
                                                        <input type="hidden" name="id" value="{$data.id}" />
                                                        <input type="hidden" name="model" value="Admin" />
                                                        <div class="modal-header">
                                                            <button class="close" data-dismiss="modal" type="button">&times;</button>
                                                            <h4 class="modal-title" id="avatar-modal-label">图片大小限制在 2.00M</h4>
                                                        </div>
                                                        <div class="modal-body">
                                                            <div class="avatar-body">
                                                                <div class="avatar-upload">
                                                                    <input class="avatar-src" name="avatar_src" type="hidden">
                                                                    <input class="avatar-data" name="avatar_data" type="hidden">
                                                                    <label for="avatarInput">图片上传</label>
                                                                    <input class="avatar-input" id="avatarInput" name="avatar_file" type="file"></div>
                                                                <div class="row">
                                                                    <div class="col-md-9">
                                                                        <div class="avatar-wrapper"></div>
                                                                    </div>
                                                                    <div class="col-md-3">
                                                                        <div class="avatar-preview preview-lg"></div>
                                                                        <div class="avatar-preview preview-md hide"></div>
                                                                        <div class="avatar-preview preview-sm hide"></div>
                                                                    </div>
                                                                </div>
                                                                <div class="row avatar-btns">
                                                                    <div class="col-md-9">
                                                                        <div class="btn-group">
                                                                            <button class="btn" data-method="rotate" data-option="-90" type="button"><i class="fa fa-undo"></i> 向左旋转</button>
                                                                        </div>
                                                                        <div class="btn-group">
                                                                            <button class="btn" data-method="rotate" data-option="90" type="button"><i class="fa fa-repeat"></i> 向右旋转</button>
                                                                        </div>
                                                                    </div>
                                                                    <div class="col-md-3">
                                                                        <button class="btn btn-info btn-block" type="submit"><i class="fa fa-save"></i> 保存修改</button>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </form>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
<script type="text/javascript">
$(function(){
    new CropAvatar($('#avatar-box'));
})
</script>
{/block}